/**
 * @author		Sergey Suzdalskiy
 * @e-mail:		sergey.suzdalskiy@gmail.com
 */
package ua.kiev.gcore.storage 
{
import flash.utils.Dictionary;

/**
	 * ...
	 * @author Yura
	 */
	public class TextItemStorage 
	{
		
		private static var items:Dictionary = new Dictionary();
		
		
		public static function addItem(item:TextItem):void{
			items[item.id] = item;
		}
		
		public static function getItemByID(id:String):TextItem{
			
			return items[id];
		}
		public static function getTextByID(id:String):String{
			return items[id];
		}
		
		public static function getTextByAlias(alias:String):String{
			var result:String = alias;
			for each(var textItem:TextItem in items){
				if(textItem.alias == alias){
					result = textItem.text;
					break;
				}
			}
			return result;
		}	
		
		
		public static function getAll():Dictionary{
			return items;
		}
		
		public static function getItems(type:String):Array{
			var result:Array = new Array();
			for each(var item:TextItem in items){
				if(item.type == type){
					result.push(item);
				}
			}
			return result;
		}
		
		
		
	}

}